 
 <#-- 
 
 crea una clase para c# para la tabla  ${table}...
 Author : Luis Molina...
 
 -->
<#-- variables used internally by the generator... -->
<#assign nameFile="${table}">
<#assign extensionFile="cs">
<#assign languageGenerated="c#">
<#assign description="c#">
<#assign targetDirectory="">
<#assign appliesToAllTables="true">
<#-- END variables used internally by the generator... -->

// ${table}....
//${table}.DeleteAll();

StringBuilder sqlt = new StringBuilder();

sqlt.Append( " SET IDENTITY_INSERT dbo.${table} ON ");
sqlt.Append( " \n ");



List<${table}> lista${table} = ${table}.getList();
foreach (${table} tix in lista${table})
{
	            
	sqlt.Append( " IF NOT EXISTS ( SELECT TOP 1 1 FROM dbo.${table} WHERE ${table.getKey()} = " + sf.cadena(tix.${table.getKey()}) +") \n ") ;
	sqlt.Append( " insert into ${table} ( ${table.getListWithAllFields()} )"); 
        sqlt.Append( "  values (");
			<#assign count=0>	
			<#list table.getFields() as field> 
				 <#-- segun el tipo de campo...   -->
				 <#switch field.getType()>
						  <#case "_int">
							 sqlt.Append( sf.mySql(tix.${field}) <#if (table.getNumberOfFields() -  count  != 1)>+ " ,"</#if>) ;
							 <#break>
						  <#case "_string">
							 sqlt.Append( sf.mySql(tix.${field}) <#if (table.getNumberOfFields() -  count  != 1)>+ " ,"</#if>) ;
							 <#break>
						  <#case "_date">
							 sqlt.Append( sf.mySql(tix.${field}) <#if (table.getNumberOfFields() -  count  != 1)>+ " ,"</#if>)  ;
							 <#break>
						  <<#case "_boolean">
							 sqlt.Append( sf.mySql(tix.${field})  <#if (table.getNumberOfFields() -  count  != 1)>+ " ,"</#if>);
							 <#break>
						  <#default>
							 sqlt.Append( sf.mySql(tix.${field}) <#if (table.getNumberOfFields() -  count  != 1)>+ " ,"</#if>) ;
				</#switch>  
				<#assign count = count+1>
			</#list>	 
			sqlt.Append(" )");
			sqlt.Append(" \n");
	
	 
}
	

	




       